package com.johnsoft.pph;

import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;

import com.johnsoft.pph.gui.GuiWelcome;
import com.johnsoft.pph.gui.IGui;
import com.johnsoft.pph.gui.PPHGui;

public class Installer {
	
	public static Installer setup;
	PPHGui mainGui;
	InstallerThread installer;
	String installFile;
	public static BufferedImage background;
	
	public static void main(String[] args)
	{
		setup = new Installer();
	}
	
	public Installer()
	{
		try {
			//background = ImageIO.read(new File("background.jpg"));
			background = ImageIO.read(ClassLoader.getSystemResources("background.jpg").nextElement());
		} catch (IOException e) {
			e.printStackTrace();
		}
		mainGui = new PPHGui();
		setGUI(new GuiWelcome());
		installer = new InstallerThread();
		installFile = "install.pph";
	}
	
	public void setGUI(IGui gui)
	{
		mainGui.setGUI(gui);
	}
	
	public void startSetup()
	{
		installer.start();
	}
	
	public void addConsoleText(String s)
	{
		mainGui.addText(s);
	}
	
	public void setInstall(String s) {
		installFile = s;
	}

}
